Conversation
magendich
commented
Jun 2, 2025

makzimi
left a comment
There was a problem hiding this comment.
Спасибо за работу! Выглядит отлично, рисует всё как надо.
Одно, но важное замечание при отрисовки вьюшек - надо все создания объектов выносить из onDraw на пораньше. Для сдачи работы надо это поправить.
| val dailyExpenses = data.groupBy { it.time * 1000L } | ||
| .mapValues { it.value.sumOf { expense -> expense.amount } } | ||
| .toSortedMap() |
There was a problem hiding this comment.
Каждый вызов groupBy, mapValues и toSortedMap создаёт новые коллекции. Лучше выносить эту логику из onDraw в setData
| for (i in 0..5) { | ||
| val time = dailyExpenses.firstKey() + dateStep * i | ||
| val x = paddingHorizontal + (time - dailyExpenses.firstKey()) * xScale | ||
| val date = Date(time) |
There was a problem hiding this comment.
Каждая итерация создаёт объект Date. Это тоже плохо. В onDraw нельзя создавать новые объекты.
| if (gradientColors.isEmpty() && colors.isNotEmpty()) { | ||
| colors.forEach { | ||
| gradientColors += SweepGradient(width, height, it.first, it.second) | ||
| } | ||
| } |
There was a problem hiding this comment.
gradientColors += … создаёт новую коллекцию при каждом добавлении, а еще и создаем каждый раз SweepGradient
There was a problem hiding this comment.
Надо тоже это вынести из onDraw
| textPaint.textSize = 60f | ||
| textPaint.typeface = Typeface.DEFAULT_BOLD | ||
| val sumText = "$dataSum ₽" | ||
| val sumBounds = Rect() |
| textPaint.textSize = 40f | ||
| textPaint.typeface = Typeface.DEFAULT | ||
| val labelText = "Потрачено в Июне" | ||
| val labelBounds = Rect() |
| @@ -0,0 +1,21 @@ | |||
| FROM eclipse-temurin:17-jdk-jammy | |||
There was a problem hiding this comment.
не будет ли контейнер больше, чем при openjdk?
| @@ -0,0 +1,21 @@ | |||
| FROM eclipse-temurin:17-jdk-jammy | |||
There was a problem hiding this comment.
пробовали его использовать? Мне кажется что будет ругаться на недостачу пакетов
| @@ -0,0 +1,69 @@ | |||
| pipeline { | |||
| agent { | |||
| dockerfile true | |||
There was a problem hiding this comment.
нужно указать название image и параметры